<?php
/**
* +---------------------------------------------------------------------------+
* | $Id: add_domains.php 39 2005-05-21 18:38:47Z vluther $ |
* +---------------------------------------------------------------------------+
* | $Rev: 39 $ |
* +---------------------------------------------------------------------------+
* | Copyright (c) 2002-2005 Linuxpowered, Inc |
* +---------------------------------------------------------------------------+
* | Author: Vidyut Luther |
* +---------------------------------------------------------------------------+
*
* $URL: http://svn.linuxpowered.com/binder/admin/add_domains.php $
**/ 

$section = "ADMIN";
$title = "Binder: Add Domains"; 
 
require_once '../global.inc.php'; 
require_once INCLUDE_PATH . '/FQDN.class.php'; 
$objDom =& new FQDN();  
$userid = $_SESSION['USERID']; 

$groupOptions = $objDom->groupOptions($userid); 

if(empty($_POST)) { 
  $tpl->assign("groupOptions",$groupOptions); 
	$tpl->display('add_domains.html'); 
} else {
	#print_array($_SESSION); 
	$userid = $_SESSION['USERID']; 
	$domains = explode("\n",$_POST['domains']) ; 
  $group = $_POST['domain_group']; 
	require_once INCLUDE_PATH . '/FQDN.class.php'; 

	$objDom =& new FQDN();  
?>
<div class="main"> 
Adding domains for <?php echo "$firstname $lastname" ; ?>  
<?php
	for($i=0;$i<count($domains);$i++) {
  	if(!empty($domains[$i])) {
    	$fqdn = $domains[$i]; 
    	$fqdn = rtrim($fqdn); 
    	echo "<li> Adding $fqdn for $userid <BR> "; 
  	}
  	
    if(strlen($fqdn) > 1) {	
  	  $objDom->mAddDomain($userid,$fqdn,$group);
    }
    unset($fqdn); 
	} 
	
	echo "Done Adding domains. <a href='fqdnlist.php'> Go here to view them </a> ";	
}


?>
